An image sensing apparatus such as a digital camera generally stores (writes) a sensed image in a detachable memory card (e.g., a compact Flash®) which incorporates a flash memory. The flash memory is nonvolatile and can repetitively erase/write data as its characteristic features.
Erase/write of data from/in a flash memory is executed by a predetermined size called a block which forms the flash memory. For example, when data are rewritten in a block in which data have already been written, previous data are erased by the block size, all data are electrically cleared, and then new data are written. In an erased block, new data are simply written by the block size.
Because of these features of the flash memory, write can be achieved at a higher speed in an erased block from which no data need be erased, than in a block in which data has already been written.
Since the memory card is used in various information devices such as a personal computer by using a predetermined adaptor (card reader/writer), a file system such as FAT (File Allocation Table) is generally constructed. The flash memory can logically discriminate a management area for the file system and a data area where data actually exists. When image data is saved in a digital camera or the like, management information in the management area is searched for the free space of the data area. It is recorded that the free space is in use, and actual image data is recorded in the data area. To the contrary, when image data is deleted or the area is formatted, image data itself in the data area is not erased but is left, and the use status of a corresponding part of image data in the management area, or for formatting, the use status of the entire part is freed.
For this processing, there is known a technique of detecting a data area which is represented as a free space in the management area, and erasing data from the detected area (e.g., Japanese Patent Laid-Open No. 2003-224809).
Recent digital cameras tend to have many image sensing pixels, and increase the data amount per unit time in the moving image photographing mode or sequential shooting mode. Previous image data may be written even in a free area, and a long time is taken to record image data in a situation in which high-speed write is required for the sequential shooting mode, high-resolution moving image photographing mode, or the like.
Even if data in the management area is erased, previous data remains in the data area, and the image data may be reconstructed against user's will.
To prevent this problem, it is apparently desirable to erase data not only from the management area of the memory card but also from the data area. However, as the capacities of recent memory cards become larger, the time taken for erase becomes considerably longer. Demands for urgently performing another process (e.g., image sensing) cannot be met.